<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html class="win-frame">
<head>
<title>${name_china}管理-编辑${name_china}</title>
<%@include file="/common/head.jsp" %>

</head>
<body class="iframe-page">
<div class="page-title-wrapper">
    <div class="page-title">
        <div class="page-title-text">
            <span>${name_china}管理</span>
            <span class="split"></span>
            <span>编辑${name_china}</span>
        </div>
        <a id="goBack" class="btn-return distance-left" href="javascript:;"><i class="icon icon-arrow-left"></i>返回上级</a>
    </div>
    <div class="page-title-border"></div>
</div>

<form id="form" method="post">
    <div class="form-wrapper">
	  <div class="h4 distance-double">
        <span class="h4-title"><i class="icon icon-setting"></i>基本信息</span>
        <span class="h4-border"></span>
      </div>
      
      <input type="hidden" id="id" name="id"/> 
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>昵称</p>
	        <input type="text" id="userNickName" name="userNickName" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>用户ID</p>
	        <input type="text" id="id" name="id" disabled /> 
	     </div> 
	     
	      <div class="form-cont">
	        <p class="form-cont-title">店铺名称</p>
	        <input type="text" id="storeName" name="storeName" class="summer-input summer-validatebox"  data-validatebox="validType:['maxLength[11]']"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title">创建时间</p>
	        <input type="text" id="createTime" name="createTime" disabled /> 
	     </div>
	 
	    <div class="form-cont">
	        <p class="form-cont-title">角色</p>
	        <input type="text" id="type" name="type" disabled class="summer-input summer-validatebox"  data-validatebox="validType:['maxLength[100]']"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title">手机号</p>
	        <input type="text" id="userPhone" name="userPhone" class="summer-input summer-validatebox"  data-validatebox="validType:['maxLength[10]']"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title">来源</p>
	        <input type="text" id="source" name="source" disabled /> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title">订单数</p>
	        <input type="text" id="orderCount" name="orderCount" disabled/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title">账户余额</p>
	        <input type="text" id="balance" name="balance" disabled /> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title">积分</p>
	        <input type="text" id="score" name="score" disabled/> <a id="points">查看</a>
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title">预估收入</p>
	        <input type="text" id="preProfit" name="preProfit" disabled/> <a id="preIncome">查看</a>
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title">收入明细</p>
	        <input type="text" id="totalProfit" name="totalProfit" disabled /> <a id="income">查看</a>
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title">邀请码</p>
	        <input type="text" id="invitingCode" name="invitingCode" disabled /> 
	     </div>
	    
	     <div >
	        <p align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	        	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;提现记录&nbsp;&nbsp;&nbsp;&nbsp;<a id="withdraw">查看</a></p>
	     </div>
	     
	     <div >
	        <p align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	        	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;邀请记录&nbsp;&nbsp;&nbsp;&nbsp;<a id="invite">查看</a></p>
	     </div>
	     
	     <!-- <div class="form-cont">
	        <p class="form-cont-title">登录记录</p>
	        <input type="text" id="type" name="type" class="summer-input summer-validatebox"  data-validatebox="validType:['maxLength[50]']"/> 
	     </div> -->
	     
     <div class="form-btn-wrapper" id="funcbar">
        <a class="btn btn-normal" id="backBtn">关闭</a>
    </div>
  </div>
</form>
<script>
    
  var   editData,
        permission = CommonUtil.getPermission('${name_english}');
    
    $(function () {
    	editData = ${editData};
    	
    	
	//初始化funcbar
		$('#funcbar').prepend($.funcbar({
			type : 'button',
			data : permission,
			permit : [ '${name_english}:edit' ]
		}));

		/* 
		$('#source').combobox({
			async : false,
			defaultValue : editData.laiyuan,
			valueField : 'code',
			textField : 'name',
			url : COMMON_URL.getCode + '?type=T_DM_T_USERS_MALL_LAIYUAN'
		});
 */
		$('#type').combobox({
			async : false,
			defaultValue : editData.type,
			valueField : 'code',
			textField : 'name',
			url : COMMON_URL.getCode + '?type=T_DM_T_USERS_MALL_TYPE'
		});

		$('#form').form({
			onLoadSuccess : function(data) {

			}
		}).form('loadDataEdit', {
			data : editData
		});

		//保存按钮
		$('#funcbar').on('click', 'a[data-permit="${name_english}:edit"]',
				submit);

		//返回按钮
		$('#backBtn, #goBack').on('click', backMain);
		$('#preIncome').on('click',topreIncome);
		$('#income').on('click',toincome);
		$('#withdraw').on('click',towithdraw);
		$('#invite').on('click',toinvite);
		$('#points').on('click',topoints);
	});
    
    function topreIncome(){
    	var id = $("#id").val();
    	window.location.href = CONST_URL.INIT_PRE_INCOME+"?id="+id;
    }
    function toincome(){
    	var id = $("#id").val();
    	window.location.href = CONST_URL.INIT_ACTUAL_INCOME+"?id="+id;
    }
    function towithdraw(){
    	var id = $("#id").val();
    	window.location.href = CONST_URL.INIT_WITHDRAW+"?id="+id;
    }
    function toinvite(){
    	var id = $("#id").val();
    	window.location.href = CONST_URL.INIT_INVITE+"?id="+id;
    }
    function topoints(){
    	var id = $("#id").val();
    	window.location.href = CONST_URL.INIT_POINTS+"?id="+id;
    }
	//表单提交
	function submit() {
		$("#form").form({
			buttons : [ '#saveBtn' ],
			ajax : {
				url : CONST_URL.EDIT
			},
			onSubmitSuccess : function(data) {
				$.stip({
					type : 'ok',//显示类型 有info、 ok、 danger
					text : '保存成功！',
					onBeforeHide : function() {
						backMain();
					}
				});
			}
		}).form("submit");
	}

	//返回主页面
	function backMain() {
		window.location.href = CONST_URL.INIT_MAIN;
	}

	//请求url
	var CONST_URL = {
		INIT_MAIN : basePath + "${common_url}init",
		EDIT : basePath + "${common_url}edit",
		PRE_INCOME: basePath + "${common_url}preIncome",
		INIT_PRE_INCOME: basePath + "${common_url}initpreIncome",
		INCOME: basePath + "${common_url}income",
		WITHDRAW: basePath + "${common_url}withdraw",
		INVITE: basePath + "${common_url}invite",
		POINTS: basePath + "${common_url}points",
		INIT_ACTUAL_INCOME: basePath + "${common_url}initActualIncome",
		INIT_POINTS: basePath + "${common_url}initPoints",
		INIT_WITHDRAW: basePath + "${common_url}initWithdraw",
		INIT_INVITE: basePath + "${common_url}initInvite"
	};
</script>
</body>
</html>